//
//  UIButton+Extension.swift
//  weibobbaj
//
//  Created by Tiffany宝 on 16/4/17.
//  Copyright © 2016年 Tiffany. All rights reserved.
//

import UIKit

extension UIButton{
    
    convenience init(titleColor:UIColor,titleFont:CGFloat,imageName:String){
        
        self.init()
//        var image = UIImage(imageLiteral: imageName)
        let image = UIImage.scalePic(imageName)
        //拉伸图片
//        image = image.resizableImageWithCapInsets(UIEdgeInsets(top: image.size.height / 2, left: image.size.width / 2, bottom: image.size.height / 2, right: image.size.width / 2))
        self.setBackgroundImage((image), forState: .Normal)
        self.setTitleColor(titleColor, forState: .Normal)
        self.titleLabel?.font = UIFont.systemFontOfSize(titleFont)
    }
}

